# Maintainer: alex korobtsov <korobcoff@gmail.com>
pkgname=qscreenshot-git
pkgver=158
pkgrel=1
pkgdesc="Simple creation and editing of screenshots"
arch=('i686' 'x86_64')
url="http://sourceforge.net/projects/qscreenshot/"
license=('GPL2z')
depends=('qt4' 'libpng')
makedepends=('git')
source=(git+https://code.google.com/p/qscreenshot/)
md5sums=('SKIP') 

pkgver() {
  cd "qscreenshot"
printf "%s%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short )"
}

_gitroot=https://code.google.com/p/qscreenshot/
_gitname=qScreenshot

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin
    msg "The local files are updated."
  else
    git clone "$_gitroot" "$_gitname"
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting build..."

  rm -rf "$srcdir/$_gitname-build"
  git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
  cd "$srcdir/$_gitname-build/$_gitname"

  # BUILD HERE

cmake -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd "$srcdir/$_gitname-build/$_gitname"
  make DESTDIR="$pkgdir/" install
}

